namespace pos.entity
{
using System;
using System.Data;
using System.Configuration;
using System.Text;
using System.Data.OleDb;
using System.Collections;
using System.Windows.Forms;
using NHibernate;
using NHibernate.Criterion;
/// <summary>
/// t_saleorder 的摘要说明
/// </summary>
public class t_saleorder:IEntityUtil
{
	//   列名称哈希表 
	private static Hashtable m_colLabels;    	 
	public static Hashtable colLabels//
	{
		get{return m_colLabels;}
	}
	//表字段名称哈希表
	private static ArrayList m_colNames;     
	public static ArrayList  colNames　
	{
		get{return m_colNames;}
	}
	private Saleorder __saleorder;
	public long seqID  
	{
		get{return __saleorder.seqID;}
		set{ __saleorder.seqID=value;}
	}
	public String userID  
	{
		get{return __saleorder.userID;}
		set{ __saleorder.userID=value;}
	}
	public long cashboxNO  
	{
		get{return __saleorder.cashboxNO;}
		set{ __saleorder.cashboxNO=value;}
	}
	public String memberSeqID  
	{
		get{return __saleorder.memberSeqID;}
		set{ __saleorder.memberSeqID=value;}
	}
	public double saleMoney  
	{
		get{return __saleorder.saleMoney;}
		set{ __saleorder.saleMoney=value;}
	}
	public double payMoney  
	{
		get{return __saleorder.payMoney;}
		set{ __saleorder.payMoney=value;}
	}
	public double changeMoney  
	{
		get{return __saleorder.changeMoney;}
		set{ __saleorder.changeMoney=value;}
	}
	public double saleAmount  
	{
		get{return __saleorder.saleAmount;}
		set{ __saleorder.saleAmount=value;}
	}
	public DateTime saleTime  
	{
		get{return __saleorder.saleTime;}
		set{ __saleorder.saleTime=value;}
	}
	private static  SaleorderDao dao=(SaleorderDao)SpringContext.Context.GetObject("SaleorderDao");
	public static SaleorderDao DAO
	{
		get{return dao;}
		
	}
	
	public t_saleorder()
	{
		__saleorder=new Saleorder();
	  	seqID=consts.long_min;
	  	userID="";
	  	cashboxNO=consts.long_min;
	  	memberSeqID="";
	  	saleMoney=consts.double_min;
	  	payMoney=consts.double_min;
	  	changeMoney=consts.double_min;
	  	saleAmount=consts.double_min;
	  	saleTime=DateTime.Now;
	  // dao=(SaleorderDao)SpringContext.Context.GetObject("SaleorderDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("seqID", @"编号");
		colNames.Add("seqID");
		m_colLabels.Add("userID", @"收银员");
		colNames.Add("userID");
		m_colLabels.Add("cashboxNO", @"钱箱");
		colNames.Add("cashboxNO");
		m_colLabels.Add("memberSeqID", @"会员编号");
		colNames.Add("memberSeqID");
		m_colLabels.Add("saleMoney", @"销售总额");
		colNames.Add("saleMoney");
		m_colLabels.Add("payMoney", @"实收金额");
		colNames.Add("payMoney");
		m_colLabels.Add("changeMoney", @"找零");
		colNames.Add("changeMoney");
		m_colLabels.Add("saleAmount", @"数量");
		colNames.Add("saleAmount");
		m_colLabels.Add("saleTime", @"销售时间");
		colNames.Add("saleTime");
	  }
	
	}
	public t_saleorder(Saleorder entity )
	{
		__saleorder=entity;
		
	  // dao=(SaleorderDao)SpringContext.Context.GetObject("SaleorderDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("seqID", @"编号");
		colNames.Add("seqID");
		m_colLabels.Add("userID", @"收银员");
		colNames.Add("userID");
		m_colLabels.Add("cashboxNO", @"钱箱");
		colNames.Add("cashboxNO");
		m_colLabels.Add("memberSeqID", @"会员编号");
		colNames.Add("memberSeqID");
		m_colLabels.Add("saleMoney", @"销售总额");
		colNames.Add("saleMoney");
		m_colLabels.Add("payMoney", @"实收金额");
		colNames.Add("payMoney");
		m_colLabels.Add("changeMoney", @"找零");
		colNames.Add("changeMoney");
		m_colLabels.Add("saleAmount", @"数量");
		colNames.Add("saleAmount");
		m_colLabels.Add("saleTime", @"销售时间");
		colNames.Add("saleTime");
	  }
	
	}
	public Object uniqueResult(DetachedCriteria dc)
    {
        return dao.uniqueResult(dc);
    }
	 public DetachedCriteria DC 
     {
        	get{return DetachedCriteria.For(typeof(Saleorder));}
     }
	public const string ENTITYNAME="t_saleorder";
	public const int SEQN0=149;
	
    public void checkAdd()
    {
		int len;
	//try{Convert.ToInt64(seqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	seqID<consts.long_min+1)
			throw (new Exception("请输入编号"));
 if(				(				  string.Format("{0}",seqID)				  )=="0")
	 throw (new Exception("编号是主健，框架要求值不能为0"));				

	
	len=userID.Trim().Length;
	if(len>20)
		 throw (new Exception("收银员字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("收银员不能为空!"));	
	

	//try{Convert.ToInt64(cashboxNO);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	cashboxNO<consts.long_min+1)
			throw (new Exception("请输入钱箱"));

	
	len=memberSeqID.Trim().Length;
	if(len>50)
		 throw (new Exception("会员编号字符长度最长不能超过50,当前长度为"+len.ToString()));	
	

	//try{Convert.ToDouble(saleMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleMoney<consts.double_min+1)
			throw (new Exception("请输入销售总额"));
		if(saleMoney>0)
			saleMoney+=0.000001;
		if(saleMoney<0)
			saleMoney-=0.000001;
		
			if(((long)((saleMoney)*100 ))*10!=(long)((saleMoney)*1000) )
				throw (new Exception("销售总额小数精度不能大于2位saleMoney="+saleMoney.ToString()));
		if(saleMoney>0)
			saleMoney-=0.000001;
		if(saleMoney<0)
			saleMoney+=0.000001;
	

	//try{Convert.ToDouble(payMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	payMoney<consts.double_min+1)
			throw (new Exception("请输入实收金额"));
		if(payMoney>0)
			payMoney+=0.000001;
		if(payMoney<0)
			payMoney-=0.000001;
		
			if(((long)((payMoney)*100 ))*10!=(long)((payMoney)*1000) )
				throw (new Exception("实收金额小数精度不能大于2位payMoney="+payMoney.ToString()));
		if(payMoney>0)
			payMoney-=0.000001;
		if(payMoney<0)
			payMoney+=0.000001;
	

	//try{Convert.ToDouble(changeMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	changeMoney<consts.double_min+1)
			throw (new Exception("请输入找零"));
		if(changeMoney>0)
			changeMoney+=0.000001;
		if(changeMoney<0)
			changeMoney-=0.000001;
		
			if(((long)((changeMoney)*100 ))*10!=(long)((changeMoney)*1000) )
				throw (new Exception("找零小数精度不能大于2位changeMoney="+changeMoney.ToString()));
		if(changeMoney>0)
			changeMoney-=0.000001;
		if(changeMoney<0)
			changeMoney+=0.000001;
	

	//try{Convert.ToDouble(saleAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleAmount<consts.double_min+1)
			throw (new Exception("请输入数量"));
		if(saleAmount>0)
			saleAmount+=0.000001;
		if(saleAmount<0)
			saleAmount-=0.000001;
		
			if(((long)((saleAmount)*100 ))*10!=(long)((saleAmount)*1000) )
				throw (new Exception("数量小数精度不能大于2位saleAmount="+saleAmount.ToString()));
		if(saleAmount>0)
			saleAmount-=0.000001;
		if(saleAmount<0)
			saleAmount+=0.000001;
	

	//try{Convert.ToDateTime(saleTime);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	saleTime.ToString().CompareTo(consts.datetime_min) <= 0 )
			throw (new Exception("请输入销售时间"));

//unique="yes" 唯一性验证
    }
    public void checkUpdate()
    {
		int len;
	//try{Convert.ToInt64(seqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	seqID<consts.long_min+1)
			throw (new Exception("请输入编号"));
 if(				(				  string.Format("{0}",seqID)				  )=="0")
	 throw (new Exception("编号是主健，框架要求值不能为0"));				

	
	len=userID.Trim().Length;
	if(len>20)
		 throw (new Exception("收银员字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("收银员不能为空!"));	
	

	//try{Convert.ToInt64(cashboxNO);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	cashboxNO<consts.long_min+1)
			throw (new Exception("请输入钱箱"));

	
	len=memberSeqID.Trim().Length;
	if(len>50)
		 throw (new Exception("会员编号字符长度最长不能超过50,当前长度为"+len.ToString()));	
	

	//try{Convert.ToDouble(saleMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleMoney<consts.double_min+1)
			throw (new Exception("请输入销售总额"));
		if(saleMoney>0)
			saleMoney+=0.000001;
		if(saleMoney<0)
			saleMoney-=0.000001;
		
			if(((long)((saleMoney)*100 ))*10!=(long)((saleMoney)*1000) )
				throw (new Exception("销售总额小数精度不能大于2位saleMoney="+saleMoney.ToString()));
		if(saleMoney>0)
			saleMoney-=0.000001;
		if(saleMoney<0)
			saleMoney+=0.000001;
	

	//try{Convert.ToDouble(payMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	payMoney<consts.double_min+1)
			throw (new Exception("请输入实收金额"));
		if(payMoney>0)
			payMoney+=0.000001;
		if(payMoney<0)
			payMoney-=0.000001;
		
			if(((long)((payMoney)*100 ))*10!=(long)((payMoney)*1000) )
				throw (new Exception("实收金额小数精度不能大于2位payMoney="+payMoney.ToString()));
		if(payMoney>0)
			payMoney-=0.000001;
		if(payMoney<0)
			payMoney+=0.000001;
	

	//try{Convert.ToDouble(changeMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	changeMoney<consts.double_min+1)
			throw (new Exception("请输入找零"));
		if(changeMoney>0)
			changeMoney+=0.000001;
		if(changeMoney<0)
			changeMoney-=0.000001;
		
			if(((long)((changeMoney)*100 ))*10!=(long)((changeMoney)*1000) )
				throw (new Exception("找零小数精度不能大于2位changeMoney="+changeMoney.ToString()));
		if(changeMoney>0)
			changeMoney-=0.000001;
		if(changeMoney<0)
			changeMoney+=0.000001;
	

	//try{Convert.ToDouble(saleAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleAmount<consts.double_min+1)
			throw (new Exception("请输入数量"));
		if(saleAmount>0)
			saleAmount+=0.000001;
		if(saleAmount<0)
			saleAmount-=0.000001;
		
			if(((long)((saleAmount)*100 ))*10!=(long)((saleAmount)*1000) )
				throw (new Exception("数量小数精度不能大于2位saleAmount="+saleAmount.ToString()));
		if(saleAmount>0)
			saleAmount-=0.000001;
		if(saleAmount<0)
			saleAmount+=0.000001;
	

	//try{Convert.ToDateTime(saleTime);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	saleTime.ToString().CompareTo(consts.datetime_min) <= 0 )
			throw (new Exception("请输入销售时间"));

//unique="yes" 唯一性验证
		ICriterion crit=Restrictions.Eq("seqID", seqID);
  		IList list=dao.List(dao.DC.Add(crit));
		if(list.Count==1)
			return;
		if(list.Count==0)
			throw (new Exception("该记录已经被删除"));	
		else
			throw (new Exception("改纪录出现重名!"));
    }
    public void add()
    {
        try
        {
            checkAdd();
         	dao.Add(__saleorder);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void delByseqID()
    {
    
        try
        {
          dao.Delete(__saleorder);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }

    public  void update()
    {
        try
        {
            checkUpdate();
            dao.Update(__saleorder);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void ExecDataUpdate(int rowNo)
    {
		if(m_updateRow==null)
			return;
		int ii=0;
m_updateRow(rowNo,ii++,				(				  string.Format("{0}",seqID)				  ));	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",saleMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",payMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",changeMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",saleAmount)/***/)
);	

    }
    public void ExecHeadInsert()
    {
		if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,50,"编号");
			m_insertHead(ii++,100,"销售总额");
			m_insertHead(ii++,100,"实收金额");
			m_insertHead(ii++,100,"找零");
			m_insertHead(ii++,80,"数量");
		}		
    }
    public void ExecDataInsert()
	{
		if(m_insertRow==null)
			return;
		int ii=0;
     	m_insertRow(0,ii++,				(				  string.Format("{0}",seqID)				  ));
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",saleMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",payMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",changeMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",saleAmount)/***/)
);
    }
    public void ExecDataInsertByQuery(DetachedCriteria dc)
    {
      
         IList list=dao.List(dc); 
        
        if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,50,"编号");
			m_insertHead(ii++,100,"销售总额");
			m_insertHead(ii++,100,"实收金额");
			m_insertHead(ii++,100,"找零");
			m_insertHead(ii++,80,"数量");
		}		
		
      if(m_insertRow!=null)
      {
        int j=0;
        foreach(Saleorder obj in list)			
        {
		  int ii=0;
	     
m_insertRow(j,ii++,				(				  string.Format("{0}",obj.seqID)
				  )
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.saleMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.payMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.changeMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.saleAmount)
					)
);
		j++;
        }
        

	
       }
    }

    
    public IList List(DetachedCriteria dc)
    {
        try
        {
           
            return dao.List(dc);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
    
    public bool Init(DetachedCriteria dc)
    {
    
    		Saleorder obj=dao.Get(dc);
    		if(obj==null)
    			return false;
    		else
    		{
    			__saleorder=obj;
            	return true;
            }
        
    }
    public static t_saleorder Get(DetachedCriteria dc)
    {
    	
    	Saleorder obj=((SaleorderDao)SpringContext.Context.GetObject("SaleorderDao"))
	 	.Get(dc);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_saleorder( obj );
        
    }
	 public static t_saleorder GetBySeqID(long val)
	 {
	 	Saleorder obj=((SaleorderDao)SpringContext.Context.GetObject("SaleorderDao"))
	 	.GetBySeqID(val);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_saleorder( obj );
	 	
	 	
	 }
	 public  bool InitBySeqID(long val)
	 {
	 	

	 	Saleorder obj=dao.GetBySeqID(val) ;
	 	if(obj==null)
	 		return false;
	 	else
	 	{
	 		__saleorder=obj;
	 		return true;
	 	}
	 	
	 	
	 }
    
       public bool showInForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["seqID"]!=null)
		{
			Controls["seqID"].Text=				(				  string.Format("{0}",seqID)				  );
		}
		if(Controls["userID"]!=null)
		{
			Controls["userID"].Text=userID;
		}
		if(Controls["cashboxNO"]!=null)
		{
			Controls["cashboxNO"].Text=				(				  string.Format("{0}",cashboxNO)				  );
		}
		if(Controls["memberSeqID"]!=null)
		{
			Controls["memberSeqID"].Text=memberSeqID;
		}
		if(Controls["saleMoney"]!=null)
		{
			Controls["saleMoney"].Text=/***/(						string.Format("{0:F2}",saleMoney)/***/)
;
		}
		if(Controls["payMoney"]!=null)
		{
			Controls["payMoney"].Text=/***/(						string.Format("{0:F2}",payMoney)/***/)
;
		}
		if(Controls["changeMoney"]!=null)
		{
			Controls["changeMoney"].Text=/***/(						string.Format("{0:F2}",changeMoney)/***/)
;
		}
		if(Controls["saleAmount"]!=null)
		{
			Controls["saleAmount"].Text=/***/(						string.Format("{0:F2}",saleAmount)/***/)
;
		}
		if(Controls["saleTime"]!=null)
		{
			Controls["saleTime"].Text=			saleTime.ToString().CompareTo("1001-1-1")<0?"":string.Format("{0:g}",saleTime);
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    public  t_saleorder Init(Saleorder item)
    {
        __saleorder=item;
        return this;
    }

    
     public bool initByForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["seqID"]!=null)
		{
			
			if(Controls["seqID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["seqID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{seqID=(v==""?consts.long_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["seqID"].Focus();
					throw  (new Exception("编号格式不正确！！"));
				}
				
			}
			else
			{
				try{seqID=(Controls["seqID"].Text==""?consts.long_min:Convert.ToInt32(Controls["seqID"].Text));}
				catch
				{
					 Controls["seqID"].Focus();
					throw  (new Exception("编号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userID"]!=null)
		{
			
			if(Controls["userID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userID=v;}
				catch
				{
					 Controls["userID"].Focus();
					throw  (new Exception("收银员格式不正确！！"));
				}
				
			}
			else
			{
				try{userID=Controls["userID"].Text;}
				catch
				{
					 Controls["userID"].Focus();
					throw  (new Exception("收银员格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["cashboxNO"]!=null)
		{
			
			if(Controls["cashboxNO"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["cashboxNO"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{cashboxNO=(v==""?consts.long_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["cashboxNO"].Focus();
					throw  (new Exception("钱箱格式不正确！！"));
				}
				
			}
			else
			{
				try{cashboxNO=(Controls["cashboxNO"].Text==""?consts.long_min:Convert.ToInt32(Controls["cashboxNO"].Text));}
				catch
				{
					 Controls["cashboxNO"].Focus();
					throw  (new Exception("钱箱格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["memberSeqID"]!=null)
		{
			
			if(Controls["memberSeqID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["memberSeqID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{memberSeqID=v;}
				catch
				{
					 Controls["memberSeqID"].Focus();
					throw  (new Exception("会员编号格式不正确！！"));
				}
				
			}
			else
			{
				try{memberSeqID=Controls["memberSeqID"].Text;}
				catch
				{
					 Controls["memberSeqID"].Focus();
					throw  (new Exception("会员编号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleMoney"]!=null)
		{
			
			if(Controls["saleMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["saleMoney"].Focus();
					throw  (new Exception("销售总额格式不正确！！"));
				}
				
			}
			else
			{
				try{saleMoney=(Controls["saleMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["saleMoney"].Text));}
				catch
				{
					 Controls["saleMoney"].Focus();
					throw  (new Exception("销售总额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["payMoney"]!=null)
		{
			
			if(Controls["payMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["payMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{payMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["payMoney"].Focus();
					throw  (new Exception("实收金额格式不正确！！"));
				}
				
			}
			else
			{
				try{payMoney=(Controls["payMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["payMoney"].Text));}
				catch
				{
					 Controls["payMoney"].Focus();
					throw  (new Exception("实收金额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["changeMoney"]!=null)
		{
			
			if(Controls["changeMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["changeMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{changeMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["changeMoney"].Focus();
					throw  (new Exception("找零格式不正确！！"));
				}
				
			}
			else
			{
				try{changeMoney=(Controls["changeMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["changeMoney"].Text));}
				catch
				{
					 Controls["changeMoney"].Focus();
					throw  (new Exception("找零格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleAmount"]!=null)
		{
			
			if(Controls["saleAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["saleAmount"].Focus();
					throw  (new Exception("数量格式不正确！！"));
				}
				
			}
			else
			{
				try{saleAmount=(Controls["saleAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["saleAmount"].Text));}
				catch
				{
					 Controls["saleAmount"].Focus();
					throw  (new Exception("数量格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleTime"]!=null)
		{
			
			if(Controls["saleTime"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleTime"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleTime=(v==""?new DateTime(1000,1,1):Convert.ToDateTime(v));}
				catch
				{
					 Controls["saleTime"].Focus();
					throw  (new Exception("销售时间格式不正确！！"));
				}
				
			}
			else
			{
				try{saleTime=(Controls["saleTime"].Text==""?new DateTime(1000,1,1):Convert.ToDateTime(Controls["saleTime"].Text));}
				catch
				{
					 Controls["saleTime"].Focus();
					throw  (new Exception("销售时间格式不正确！！"));
				}
				
			}
				
				
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    

}

}
